package  
{
	import net.flashpunk.Entity;
	import net.flashpunk.masks.Pixelmask;
	import net.flashpunk.graphics.Spritemap;
	/**
	 * ...
	 * @author Donatello
	 */
	public class Girl extends Entity
	{
		[Embed(source = "img/sheets/girlSheet.png")] private const PLAYER_ANIM:Class;
		[Embed(source = "img/sheets/girl.png")] private const PLAYER_PIX:Class;
		private var playerAnim:Spritemap;
		public var state:String = "walking";
		private var walking:Boolean = true;
		
		public function Girl(px:Number=305,py:Number=500) 
		{
			playerAnim = new Spritemap(PLAYER_ANIM, 54,147);
			
			playerAnim.add("idle", [0], 10, true);
			playerAnim.add("walking", [1,2,3,4], 10, true);
			
			graphic = playerAnim;
			
			mask = new Pixelmask(PLAYER_PIX);
			type = "Girl";
			
			x = px;
			y = py;
			
			playerAnim.play("walking");
				
		}
		
		override public function update():void
		{
			if (state == "walking")
				x += 1;
			
		}
		
		public function stop():void
		{
			state = "idle";
			playerAnim.play(state);
			walking = false;
		}
		
		public function walk():void
		{
			if(!walking)
			{
				state = "walking";
				playerAnim.play(state);
				walking = true;
			}
		}
		

	}

}